using System;
using System.Data;

using Wicresoft.Common;

namespace Wicresoft.Messages.Entity
{
    [Table("DeviceStatus", "", "Wicresoft.Messages.ConnectionString")]
    public class DeviceStatus : Info
    {
        #region SQL column name consts
        public const string SQLCOL_DEVICEID = "DeviceID";
        public const string SQLCOL_OUTGOINGSTATUS = "OutgoingStatus";
        public const string SQLCOL_INCOMINGSTATUS = "IncomingStatus";
        #endregion


        #region Contructors
        /// <summary>
        /// Construct empty entity
        /// </summary>
        public DeviceStatus() { }

        /// <summary>
        /// Construct entity by primary key, other fields will be assigned by 
        /// "Load" method.
        /// </summary>
        public DeviceStatus(int DeviceID)
        {
            this.DeviceID = DeviceID;
        }
        #endregion

        public override void Init(DataRow row)
        {
            DeviceID = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_DEVICEID]);
            OutgoingStatus = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_OUTGOINGSTATUS]);
            IncomingStatus = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_INCOMINGSTATUS]);
        }

        #region Properties
        #region Property <int> DeviceID
        [Property("DeviceID", 4, SqlDbType.Int, false, true)]
        public int DeviceID
        {
            get { return _DeviceID; }
            set { _DeviceID = value; }
        }
        private int _DeviceID = int.MinValue;
        #endregion

        #region Property <int> OutgoingStatus
        [Property("OutgoingStatus", 4, SqlDbType.Int, false, false)]
        public int OutgoingStatus
        {
            get { return _OutgoingStatus; }
            set { _OutgoingStatus = value; }
        }
        private int _OutgoingStatus = int.MinValue;
        #endregion

        #region Property <int> IncomingStatus
        [Property("IncomingStatus", 4, SqlDbType.Int, false, false)]
        public int IncomingStatus
        {
            get { return _IncomingStatus; }
            set { _IncomingStatus = value; }
        }
        private int _IncomingStatus = int.MinValue;
        #endregion
        #endregion




    }
}
